package com.xiaoxu.privatechat.entity.common;

import com.xiaoxu.privatechat.annotion.ValidateEntity;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

/**
 * @author xiaoxu
 * @description 消息记录实体类
 * @date 223/2/13
 */
@Entity
@Table(name = "pc_msg_log")
@EntityListeners(AuditingEntityListener.class)
public class MsgLog extends BaseEntity {
    private static final long serialVersionUID = 1L;
    /**
     * 已读
     */
    public static final int MSG_STATUS_READ = 1;
    /**
     * 未读
     */
    public static final int MSG_STATUS_UNREAD = 0;

    /**
     * 所属用户
     */
    @ManyToOne
    @JoinColumn(name = "account_id")
    private Account account;
    /**
     * 消息实体
     */
    @ManyToOne
    @JoinColumn(name = "msg_content_id")
    private MsgContent msgContent;
    /**
     * 默认正常
     */
    @ValidateEntity()
    @Column(name = "status", length = 1)
    private int status = MSG_STATUS_UNREAD;

    public Account getAccount() {
        return account;
    }

    public void setAccount(Account account) {
        this.account = account;
    }

    public MsgContent getMsgContent() {
        return msgContent;
    }

    public void setMsgContent(MsgContent msgContent) {
        this.msgContent = msgContent;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    @Override
    public String toString() {
        return "MsgLog [account=" + account + ", msgContent=" + msgContent
                + ", status=" + status + "]";
    }


}
